package com.sfac.springBoot.modules.test.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.sfac.springBoot.modules.common.entity.AbstractEntity;

import javax.persistence.*;
import java.util.List;

/**
 * @Description Clazz
 * @Author HymanHu
 * @Date 2022/7/1 14:06
 */
@Entity
@Table(name = "test_clazz")
public class Clazz extends AbstractEntity {

	private String clazzName;

	@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@JoinColumn(name = "schoole_id", insertable = false, updatable = false)
	@JsonIgnore
	private School school;

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@JoinTable(name = "test_clazz_student",
			joinColumns = @JoinColumn(name = "clazz_id"),
			inverseJoinColumns = @JoinColumn(name="student_id"))
	private List<Student> students;

	public String getClazzName() {
		return clazzName;
	}

	public void setClazzName(String clazzName) {
		this.clazzName = clazzName;
	}
}
